package edu.hwadee.BEIS.constants;

import com.alibaba.fastjson.JSON;

/**
 * 错误码枚举类
 * 所有错误码都在此处定义
 * 便于管理
 * @author kingsong
 *
 */
public enum ResultEnum {

	UNKNOWN_ERROR(-1,"未知错误"),
	SUCCESS(200,"成功"),
	CERTIFICATE_WRONG(1001,"凭证错误"),
	SCHOOL_ISEXITED(1002,"学校编号已存在"),
	SCHOOL_NOT_EXIST(2001,"学校编号不存在"),
	USER_NOTEXIST(1003,"用户不存在"),
	USER_PSW_WRONG(1004,"密码错误"),
	USER_LOGIN_FAILURE(1005,"登录失败"),
	SCHOOL_USER_NOTEXIST(1006,"学校用户不存在"),
	PROJECTDACLARE_NOTEXIST(1007,"项目申报记录不存在"),
	ANALYSISDIAGRAM_EMPTY(1008,"上传图表为空"),
	FILE_SAVE_FAILURE(1009,"保存文件失败"),
	ANALYSISDIAGRAM_NOTEXIST(1010,"分析图表不存在"),
	ANALYSISDIAGRAM_DELETE_FAILURE(1011,"分析图表删除失败"),
	PWD_SHA512(1012,"密码加密失败"),
	ADMINCODE_ISBEENUSED(1013,"行政编号已存在"),
	CITYUSER_ISEXISTED(1014,"用户名已存在"),
	SCHOOLUSER_ISEXISTED(1015,"用户名已存在"),
	COUNTYUSER_ISEXISTED(1016,"用户名已存在"),
	LEADERUSER_ISEXISTED(1017,"用户名已存在"),
	PWD_MODIFY_FALURE(1018,"修改密码失败"),
	NOT_REGISTER_TIME(2002,"不是填报时间");
	
	private int code;
	private String msg;
	
	private ResultEnum(int code, String msg) {
		this.code = code;
		this.msg = msg;
	}

	public int getCode() {
		return code;
	}

	public void setCode(int code) {
		this.code = code;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}
	
	@Override
	public String toString() {
		return JSON.toJSONString(this);
	}
}
